<?php

namespace app\merchant\model;

use think\Model;

/**
 * 实际订单的还款计划
 */
class TpActualInvestRepay extends Model
{

    //设置当前模型对应的完整数据表名称
    protected $table = 'tp_actual_invest_repay';

    //资金状态 1-还款中，2-已还款，3-还款终止，4-提前还款
    CONST STATUS_PAYING = 1; //还款中
    CONST STATUS_PAIED = 2; //已还款
    CONST STATUS_TERMINATE = 3; //还款终止
    CONST STATUS_BEFORE = 4; //提前还款
    
    /**
     * 获取状态列表
     * @return string
     */
    public static function getStatusList()
    {
        $list = [
            self::STATUS_PAYING => '还款中',
            self::STATUS_PAIED => '已还款',
            self::STATUS_TERMINATE => '还款终止',
            self::STATUS_BEFORE => '提前还款',
        ];
        
        return $list;
    }
    
    /**
     * 获取状态名称
     * @param type $status 状态代码
     * @return type 状态名称
     */
    public static function getStatusName($status)
    {
        $list = [
            self::STATUS_PAYING => '还款中',
            self::STATUS_PAIED => '已还款',
            self::STATUS_TERMINATE => '还款终止',
            self::STATUS_BEFORE => '提前还款',
        ];
        
        return isset($list[$status]) ? $list[$status] : '未知状态类型：' . $status;
    }

}
